﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SSN.Objects;
using SSN.Utilities.Database;
using SSN.Utilities;
using SSN.Data.Database;
namespace SSN.WebFramework
{
    public class StaticFile : SafeDbObject
    {
        #region dbase stuff
        public const SSNDBType DatabaseType = SSNDBType.BossSQL;
        protected override SSNDBType DataBaseType
        {
            get { return StaticFile.DatabaseType; }
        }

        public const string TableName = "fw_static_files";
        public override string DataTableName
        {
            get { return StaticFile.TableName; }
        }

        protected override bool SetKeyFields()
        {
            this.Context.DataKeys["id"] = -1;
            return true;
        }

        public override string ObjectName
        {
            get { return "SSN.WebFramework.StaticFile"; }
        }
        #endregion

        #region properties
        public int ID
        {
            get { return (int)this["id"]; }
        }

        public string Title
        {
            get { return (string)this["title"]; }
            set { this["title"] = value; }
        }

        public string RelativePath
        {
            get { return (string)this["relative_path"]; }
            set { this["relative_path"] = value; }
        }

        public DateTime LastUpdated
        {
            get { return (DateTime) this["last_update"]; }
        }

        public DateTime DateCreated
        {
            get { return (DateTime) this["date_created"]; }
        }

        public bool Visible
        {
            get { return !((bool) this["hidden"]); }
        }

        #endregion
    }
}
